<?php/*  PHP version 5  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220*/

namespace inc_application\link;
class OrderLink {
	public static function get_order_link($linkcode = false, $read = array()) {
		global $espcms_command;
		$link_array = array();
		if ($espcms_command['IS_REWRITE']) {
			$link_array['buy'] = espcms_url_out(array('Order_Buy_' . $read['did']), true);
			$link_array['list'] = espcms_url_out(array('Order_List'), true);
			$link_array['settlement'] = espcms_url_out(array('Order_Settlement'), true);
			$link_array['save'] = espcms_url_out(array('Order_Save'), true);
			$link_array['del'] = espcms_url_out(array('Order_DelOrder'), true);
			$link_array['pay_typeread'] = espcms_url_out(array('Order_PayTypeRead_' . $read['oid']), true);
			$link_array['pay_ok'] = espcms_url_out(array('Order_PayOk_' . $read['oid']), true);
			$link_array['editsave'] = espcms_url_out(array('OrderMain_EditSave_' . $read['oid']), true);
			$link_array['view'] = espcms_url_out(array('OrderMain_View_' . $read['oid']), true);
			$link_array['cancel'] = espcms_url_out(array('OrderMain_Cancel_' . $read['oid']), true);
			$link_array['edit'] = espcms_url_out(array('OrderMain_View_' . $read['oid'].'_edit'), true);
		} else {
			$action_key_join['ac'] = 'Order';
			$action_key_join['at'] = 'Buy';
			$action_key_join['did'] = $read['did'];
			$link_array['buy'] = espcms_url_out($action_key_join);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'List';
			$link_array['list'] = espcms_url_out($action_key);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'Settlement';
			$link_array['settlement'] = espcms_url_out($action_key);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'Save';
			$link_array['save'] = espcms_url_out($action_key);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'DelOrder';
			$link_array['del'] = espcms_url_out($action_key);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'PayTypeRead';
			$action_key['oid'] = $read['oid'];
			$link_array['pay_typeread'] = espcms_url_out($action_key);
			$action_key['ac'] = 'Order';
			$action_key['at'] = 'PayOk';
			$action_key['oid'] = $read['oid'];
			$link_array['pay_ok'] = espcms_url_out($action_key);
			$action_key['ac'] = 'OrderMain';
			$action_key['at'] = 'EditSave';
			$action_key['oid'] = $read['oid'];
			$link_array['editsave'] = espcms_url_out($action_key);
			$action_key['ac'] = 'OrderMain';
			$action_key['at'] = 'View';
			$action_key['oid'] = $read['oid'];
			$link_array['view'] = espcms_url_out($action_key);
			$action_key['ac'] = 'OrderMain';
			$action_key['at'] = 'Cancel';
			$action_key['oid'] = $read['oid'];
			$link_array['cancel'] = espcms_url_out($action_key);
			$action_key['ac'] = 'OrderMain';
			$action_key['at'] = 'View';
			$action_key['type'] = 'edit';
			$action_key['oid'] = $read['oid'];
			$link_array['edit'] = espcms_url_out($action_key);
		}
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}
	public static function order_member_link($read = array(), $pageid = 0) {
		global $espcms_command;
		if ($espcms_command['IS_REWRITE']) {
			$action_key[] = espcms_ismatches($pageid) && $pageid ? 'OrderMain_List_' . $pageid : 'OrderMain_List';
			$link = espcms_url_out($action_key, true);
		} else {
			$action_key['ac'] = 'OrderMain';
			$action_key['at'] = 'List';
			if (espcms_ismatches($pageid) && $pageid) {
				$action_key['pageid'] = $pageid;
			}
			$link = espcms_url_out($action_key);
		}
		return $link;
	}
	public static function get_order_payweb_link($linkcode = false, $read = array()) {
		$link_array = array();
		$action_key['ac'] = 'Order';
		$action_key['at'] = 'Pay';
		$action_key['oid'] = $read['oid'];
		$action_key['paycode'] = $read['paycode'];
		$link_array['pay_link'] = espcms_url_out($action_key, false, false, true);
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}
	public static function get_order_pay_link($linkcode = false, $read = array()) {
		$link_array = array();
		$action_key['ac'] = 'OrderReturn';
		$action_key['at'] = 'SyncUpdate';
		$action_key['paycode'] = $read['paycode'];
		$link_array['return_url'] = espcms_url_out($action_key, false, false, true);
		$link_array['notify_url'] = espcms_url_out(array(), false, false, true);
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}
	public static function order_js_link($linkcode = false, $read = array()) {
		$link_array = array();
		$action_key['ac'] = 'Order';
		$action_key['at'] = 'JsOrder';
		$action_key['file'] = $read['file'];
		$link_array['js_order'] = espcms_url_out($action_key);
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}
}
